package edu.stu.software.family.RabbitMQ;

import java.util.Scanner;

import com.rabbitmq.client.Channel;
import com.rabbitmq.client.Connection;

public class MQSend {

    private final static String QUEUE_NAME = "/";

    /**
	 * 
	 * @author liupanting
	 *
	 */
         public static void sendMsg(String msg) throws Exception{
        //
        Connection connection = MQContUtils.getConnection();
        //
        Channel channel = connection.createChannel();
        //
        channel.queueDeclare(QUEUE_NAME,false,false,false,null);
        //
        channel.basicPublish("", QUEUE_NAME, null, msg.getBytes());
        //
        channel.close();
        connection.close();
    }

    @SuppressWarnings("resource")
	public static void main(String[] args) throws Exception{
        while (true){
            //String read = FileNioReader.read("C:\\Users\\YWJ0806\\Desktop\\JavaBasicExercise\\a.xlsx");
           String read = new Scanner(System.in).next();
            // 
            sendMsg(read);
        }
    }

}